<template>
	<view class="footer-content">
		<view class="item" :class="{'active': idx == 1}" @click="btnClick(1, '/pages/index')">
			<image src="https://zhzx.on-line-demo.com/image/sy-active.png" mode="heightFix" class="icon-image" v-if="idx == 1"></image>
			<image src="https://zhzx.on-line-demo.com/image/sy.png" mode="heightFix" class="icon-image" v-else></image>
			首页
		</view>
		<view class="item" :class="{'active': idx == 2}" @click="btnClick(2, '/pages/resumption/resumption')">
			<image src="https://zhzx.on-line-demo.com/image/lz-active.png" mode="heightFix" class="icon-image" v-if="idx == 2"></image>
			<image src="https://zhzx.on-line-demo.com/image/lz.png" mode="heightFix" class="icon-image" v-else></image>
			履职
		</view>
		<view class="item" :class="{'active': idx == 3}" @click="btnClick(3, '/pages/memberHome/memberHome')">
			<image src="https://zhzx.on-line-demo.com/image/wyj-active.png" mode="heightFix" class="icon-image" v-if="idx == 3"></image>
			<image src="https://zhzx.on-line-demo.com/image/wyzj.png" mode="heightFix" class="icon-image" v-else></image>
			委员之家
		</view>
		<view class="item" :class="{'active': idx == 4}" @click="btnClick(4, '/pages/my/my')">
			<image src="https://zhzx.on-line-demo.com/image/wd-active.png" mode="heightFix" class="icon-image" v-if="idx == 4"></image>
			<image src="https://zhzx.on-line-demo.com/image/wd.png" mode="heightFix" class="icon-image" v-else></image>
			我的
		</view>
	</view>
</template>

<script>
	export default {
		props:['idx'],
		data() {
			return {
				
			}
		},
		mounted() {
			uni.$on('toPage', (index) => {
				console.log(index)
				this.btnClick(index)
			})
		},
		methods: {
			btnClick(index, url){
				uni.$emit('btnClick', index)
				// uni.redirectTo({
				// 	url: url
				// });
			},
		}
	}
</script>

<style>
	.footer-content{
		display: flex;
		align-items: center;
		justify-content: space-between;
		width: 100%;
		position: fixed;
		bottom: 0px;
		border-top: 1px solid #efefef;
		background-color: #fff;
		height: 60px;
	}
	.item{
		width: calc(100% / 4);
		text-align: center;
		color: #909090;
		font-size: 12px;
	}
	.icon-image{
		height: 26px;
		max-width: 26px;
		display: block;
		margin: 0px auto 2px;
	}
	.active{
		color: #175890;
	}
</style>